/*
 *	This file is part of Lounge-Cast.
 *
 *  Author:  	Markus Moormann
 *	E-mail:  	mmoorman@uni-osnabrueck.de
 *	Copyright:	University of Osnabrueck (Zentrum Virtuos)
 * 	Website:	www.uni-osnabrueck.de
 *	Date:		16.02.2011
 *
 *	Lounge-Cast is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *	Lounge-Cast is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Lounge-Cast.  If not, see <http://www.gnu.org/licenses/>.
 */
package backend.vo;

/**
 * class represents a media with all common data
 *
 * @author Markus Moormann
 */
public class MediaVO {

	/**
	 * a unique id identifying the media by a MD5-hash
	 */
	public String media_id;
	/**
	 * type of media ('video'|'text'|'slide'|'image')
	 */
	public String type;
	/**
	 * title of media
	 */
	public String title;
	/**
	 * start date as UNIX timestamp
	 */
	public long start_date;
	/**
	 * valid date as UNIX timestamp
	 */
	public long valid_date;
	/**
	 * true if newsticker is allowed, false else
	 */
	public boolean newsticker;
	/**
	 * duration of the media
	 */
	public double duration;
	/**
	 * further reference
	 */
	public String reference;
	/**
	 * timestamp when media was added
	 */
	public long added;
	/**
	 * the user who added the media
	 */
	public UserVO addedBy;
	/**
	 * whether the media is approved or not
	 */
	public boolean approved;
	/**
	 * whether the media is converted or not
	 */
	public boolean converted;
	/**
	 * position in playlist
	 */
	public float position;
	/**
	 * the playlist a media may belong to
	 */
	public int playlist_id;
	/**
	 * feed this media belongs to
	 */
	public FeedVO feed;
	
	public String feed_item_uri;
	
	public boolean hide_title;
	
	public int title_color;
	
	public CategoryVO category;
	
	/**
	 * default constructor
	 */
	public MediaVO(){}
	
	/**
	 * constructor
	 * 
	 * @param media_id unique id of the media (MD5)
	 * @param type type of the media('video'|'text'|'slide'|'image')
	 * @param title title of media
	 * @param valid_date valid date of media as UNIX timestamp
	 * @param newsticker whether newsticker should be shown or not
	 * @param duration the duration of the media
	 * @param reference further reference
	 */
	public MediaVO(String media_id, 
				   String type, 
				   String title, 
				   long start_date,
				   long valid_date,
				   boolean newsticker,
				   double duration,
				   String reference) {
		this.media_id = media_id;
		this.type = type;
		this.title = title;
		this.start_date = start_date;
		this.valid_date = valid_date;
		this.newsticker = newsticker;
		this.duration = duration;
		this.reference = reference;
	}
	
	/**
	 * clones a media
	 * 
	 *  @return a new instance of <code>MediaVO</code> containing the same data
	 */
	public MediaVO clone() {
		MediaVO media = new MediaVO(media_id,
									type,
									title,
									start_date,
									valid_date,
									newsticker,
									duration,
									reference);
		media.feed_item_uri = feed_item_uri;
		media.added = added;
		media.addedBy = addedBy;
		media.approved = approved;
		media.converted = converted;
		media.position = position;
		media.playlist_id = playlist_id;
		media.feed = feed;
		media.category = category;
		media.hide_title = hide_title;
		media.title_color = title_color;
		return media;
	}
	
}
